package com.jeeos.modules.system.controller;

import com.jeeos.framework.api.Result;
import com.jeeos.framework.utils.UserUtils;
import com.jeeos.modules.system.foreign.ForeignClient;
import com.jeeos.modules.system.user.service.SysUserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.Authentication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api")
public class CurrentController {

    private final static Logger logger = LoggerFactory.getLogger(CurrentController.class);

    @Autowired
    ForeignClient foreignClient;

    @Autowired
    SysUserService sysUserService;

    @GetMapping("/public/system/hello")
    public String hello(int year) {
//        List<SysUser> list = sysUserService.list();
//        SysUser sysUser = list.get(0);
        logger.info("-------------system hello-------------");
        return "foreignClient.hello()";
    }
    /**
     * Oauth2登录认证
     */
    @GetMapping("/currentUser")
    public Result postAccessToken(){
        String userName = UserUtils.getUserName();
        return Result.success(userName);
    }

}
